/*
实现红黑树
*/

#ifndef _REDBLACKTREE_H
#define _REDBLACKTREE_H

#define ElementType int

struct RBNode;
typedef struct RBNode* Position;
typedef struct RBNode* pRBNode;
typedef struct RBNode* RBTree;

//红黑树销毁,红黑树的初始化直接向插入函数中传入空指针即可，不单独设置构造函数
void DisposeRBTree(RBTree tree);

//静态查找、动态插入即删除
RBTree Insert(RBTree tree, ElementType data);
RBTree Remove(RBTree tree, ElementType data);
Position Search(RBTree tree, ElementType data,Position* pp);

//红黑树是一种BBST，遍历同BST
void PreOrder(RBTree tree);
void InOrder(RBTree tree);
void PostOrder(RBTree tree);

void TestRedBlackTree();

#endif